local jiudechibang_distance = fk.CreateSkill {

  name = "#jiudechibang_distance",
  attached_equip = "jiudechibang",
  tags = { Skill.Compulsory, },

}
jiudechibang_distance:addEffect(fk.TurnStart, {
  name = "#jiudechibang_skill",
  mute = true,
  global = true,
  can_trigger = function(self, event, target, player, data)
    if target == player and #player:getCardIds(Player.Judge) > 0 and #player:getCardIds(Player.Equip) > 0
        and table.find(player:getCardIds(Player.Equip), function(cid)
          return Fk:getCardById(cid).name == "jiudechibang"
        end)
    then
      event:setCostData(self, table.filter(player:getCardIds("j"), function(cid)
        return Fk:getCardById(cid).trueName == "supply_shortage" or Fk:getCardById(cid).trueName == "indulgence"
      end))
      return #event:getCostData(self) > 0
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:broadcastPlaySound(Thbattle_path .. "audio/card/male/jiudechibang")
    player.room:throwCard(event:getCostData(self), jiudechibang_distance.name, player)
  end
})


jiudechibang_distance:addEffect("distance", {
  correct_func = function(self, from, to)
    if from:hasSkill(jiudechibang_distance.name) then
      return -1
    end
  end,
})

return jiudechibang_distance